/*
 * CurrencyTableCellRenderer.java
 *
 */

package jerbo.util;

/**
 *
 * @author Luigi Paioro
 */
public class CurrencyTableCellRenderer extends javax.swing.table.DefaultTableCellRenderer {
    
    java.util.ResourceBundle appBundle = java.util.ResourceBundle.getBundle("jerbo/resources/JerboApp"); // NOI18N

    public CurrencyTableCellRenderer() {
        super();
        setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    }

    @Override
    public void setValue(Object value) {
      if ((value != null) && (value instanceof Number)) {
        String format = appBundle.getString("Application.currency.format");
        java.text.DecimalFormatSymbols symbols = new java.text.DecimalFormatSymbols();
        symbols.setDecimalSeparator('.');
        java.text.DecimalFormat decFormat = new java.text.DecimalFormat(format, symbols);
        value = decFormat.format(value);
      }
      super.setValue(value);
    } 
    
}
